package org.budo.dubbo.protocol.http.authentication;

import org.budo.support.spring.context.aware.BudoApplicationContextAware;
import org.budo.support.spring.util.SpringUtil;

import lombok.Getter;
import lombok.Setter;

/**
 * 基类
 * 
 * @author limingwei
 */
@Getter
@Setter
public abstract class AbstractAuthenticationCheckInterceptor {
    private Boolean defaultAuthenticationCheck = false;

    private AuthenticationCheckService authenticationCheckService;

    private String authenticationCheckServiceBeanName;

    private String loginUrl;

    public AuthenticationCheckService getAuthenticationCheckService() {
        if (null != this.authenticationCheckService) {
            return this.authenticationCheckService;
        }

        if (null != this.authenticationCheckServiceBeanName) {
            return this.authenticationCheckService = (AuthenticationCheckService) SpringUtil.getBeanCached(this.authenticationCheckServiceBeanName);
        }

        return this.authenticationCheckService = BudoApplicationContextAware.getBeanCached_2(AuthenticationCheckService.class);
    }
}